home *** CD-ROM | disk | FTP | other *** search
/ Aminet 31 / Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso / Aminet / util / pack / brlecomp.lha / BRLECompressor.TXT < prev    next >
Text File  |  1992-10-24  |  9KB  |  239 lines

  1.  
  2. -----------------------------------------------------------------------------
  3.  B.R.L.E IMAGE COMPRESSOR V1 - (C) 1999 NAVEED KHUGIANI / ALGOTECH SOFTWARE
  4. -----------------------------------------------------------------------------
  5.  
  6. DISCLAIMER
  7.  
  8. A Short but effective disclaimer...
  9.  
  10. No responsibility will be taken for any damage to anything due to use of
  11. this program.  Use at your own risk.
  12.  
  13.  
  14. INTRODUCTION
  15.  
  16. Digitized imagery takes up a lot of diskspace.  A few dozen images of this
  17. type can use megabytes of diskspace.  To save diskspace there is the option
  18. of using JPEG compression.  This will indeed make the image a lot smaller
  19. but the quality of the image will be worse than the original and JPEG
  20. compression/decompression takes up lots of processor time.
  21. Ideally the image should be compressed without any loss in quality and be
  22. compressed and decompressed very quickly when needed.
  23.  
  24.  
  25. WHAT DOES THIS PROGRAM DO ?
  26.  
  27. This program compresses a 320x256 greyscale chunky format image to around
  28. a quarter of its original size very quickly.  This compressed file
  29. can be stored away and viewed using this utility or optionally decompressed
  30. and saved in one of 3 file formats.
  31. A typical greyscale image which would normally take up 81920 bytes (80k) can
  32. be compressed to 22k in just 2 seconds on a standard 68000 processor.
  33. The size of the compressed file is better than the majority of other
  34. compression programs which would take up to 300 times longer and still give
  35. a larger file size.
  36.  
  37.  
  38. SYSTEM REQUIREMENTS
  39.  
  40. This utility will run on any Amiga system and any kickstart version.  The
  41. program can use up to 256k of ram when decompressing. but this should be no
  42. problem even for 512k Amiga systems.
  43.  
  44.  
  45. PROGRAM SYNTAX
  46.  
  47. To compress data
  48.  
  49. BRLECompressor -c <sourcefile> <destfile>
  50.  
  51. -c   : Using this parameter tells the utility to compress the data
  52. <sourcefile> is the image file.  It must be a 320x256 chunky image which is
  53.              81920 bytes in size.
  54. <destfile> is the name of the compressed data to create
  55.  
  56.  
  57. To decompress data
  58.  
  59. BRLECompressor -d <sourcefile> <destfile> <saveformat>
  60.  
  61. -d   : Using this parameter tells the utility to decompress the data
  62. <sourcefile> is the name of the compressed image.
  63. <destfile> is the name of the decompressed file to create.
  64. <saveformat> can be any one of the following :
  65.                            -S1   : Amiga RAW PLANAR (40960 bytes)
  66.                            -S2   : CHUNKY 320x256 (81920 bytes)
  67.                            -S3   : IFF ILBM (uncompressed)
  68.  
  69.  
  70. To view the compressed image.
  71.  
  72. BRLECompressor -v <sourcefile>
  73.  
  74. -v   : Using this parameter tells the utility to view the compressed image.
  75. <sourcefile> is the name of the compressed image.
  76.  
  77. Currently the program can only compress greyscale (16 colour) 320x256
  78. images.  The file size has to be exactly 81920 bytes (320x256 bytes)
  79. Utilities such as GFXMaster and PicCon can load images and save them in this
  80. format.  It is important to ensure that the image is in 16 shade greyscale
  81. with a linear palette (starting from black and gradually increasing to
  82. white)
  83.  
  84.  
  85. EXAMPLES
  86.  
  87. Included in this archive is a raw CHUNKY 320x256 file called 'emmaspc.raw'.
  88. To compress this file and to call the compressed file 'testfile' type in
  89. something like this:
  90.                      BRLECompressor -c emmaspc.raw testfile
  91. After a few seconds the file will be compressed.
  92.  
  93. To view this compressed image file:
  94.                      BRLECompressor -v testfile
  95. The image will be displayed after decompression.
  96.  
  97. It is also possible to decompress the compressed file to one of three
  98. different formats.  To decompress the file to an IFF ILBM and to call the
  99. ILBM file 'test.iff' :
  100.                      BRLECompressor -d testfile test.iff -s3
  101. This will decompress the compressed file and save it as an ILBM file called
  102. 'test.iff'
  103.  
  104.  
  105. WHAT THIS UTILITY CAN BE USED FOR
  106.  
  107. * Fast archived image storage.  Images can be compressed fast and stored
  108.   away taking up a very small size.  Can be viewed and decompressed back to
  109.   the original form whenever needed at a very high speed.
  110.  
  111. * Disk slideshows.  Around 40 images (Yes 40!) can be stored on 1 disk and
  112.   this program can be used to decompress and view them at very high speed.
  113.  
  114.  
  115. TECHNICAL
  116.  
  117. The compressor uses a bit based run length encoder which takes up 1 bit for
  118. every repeating byte in the image data sequence.  This gives excellent
  119. compression for most types of complex digitized images.  but can give very
  120. poor compression ratio's if the compression is applied to data which
  121. features lots of empty gaps in the image.
  122. A typical run length encoder would be able to store hundreds of repeating
  123. bytes along with a marker in just 2 or 3 bytes.
  124. Using the method in this program, a constantly repeating section of data
  125. which is the same for 1000 pixels would take up 1000 bits (over 100 bytes)
  126. This is why it is important to ensure that the image is full screen and
  127. consists of lots of digitized data.
  128. This Image compression algorithm performs better than most compressors
  129. because it works directly on chunky images and is specifically suited for
  130. complex greyscale digipics.  However it seems that powerful LZ based
  131. routines (LZX & Crunchmania) can give better compression if compressing the
  132. original chunky data.  A few reasons why the BRLECompressor can be ideal for
  133. compressing images and viewing them later.
  134.  
  135. Example:
  136.  
  137. A straightforward way to compress images to give good compression and easy
  138. viewing would be to compress an IFF ILBM file using a program such as
  139. crunchmania.  Once a selection of files are compressed.  A patch such as
  140. 'RTDD' can be run and most picture viewers will automatically decompress the
  141. file after loading.
  142. However the compression will normally be poorer as the compressor has worked
  143. directly on the IFF ILBM file.
  144. Compression can be better (better than the BRLECompressor) if the IFF ILBM
  145. was converted to CHUNKY and then compressed but is there a viewer which can
  146. load chunky images directly??  No! So this method cannot be used.
  147.  
  148. As the BRLECompressor decompresses to chunky and converts to planar (to
  149. display the image) very fast.  This seems to be the ideal solution.
  150. Good compression ratio and very fast speed.
  151.  
  152. The whole point in this utility is to provide superfast speed in compression
  153. and decompression while still giving a better compression ratio than most
  154. compressors.
  155.  
  156.  
  157. QUESTIONS AND ANSWERS
  158.  
  159. Q: Why does decompression of a file take longer than compression when
  160.    viewing a compressed file or saving in ILBM or RAW Planar
  161.  
  162. A: The reasone why compression is so fast is because the program loads a
  163.    chunky image directly without conversion and compresses the data.
  164.    On the other hand.  When decompressing a file, the file in most cases has
  165.    to be converted after decompression to PLANAR format.  This is why the
  166.    decompressor can take longer.  The actual decompressor is just as fast as
  167.    the compressor.
  168.  
  169.  
  170. Q: When viewing a compressed file using this utility, the picture appears
  171.    scrambled.
  172.  
  173. A: In most cases this is because the order of the palette data in a
  174.    greyscale image was different when originally compressing the chunky
  175.    data.
  176.    The original image which is to be converted to CHUNKY format and
  177.    compressed using this utility has to have a dark-light linear greyscale
  178.    palette which starts from black and gradually goes to white.
  179.    It is also important to ensure that the image has no more than 16 shades.
  180.  
  181.  
  182. COMPRESSION GAINS
  183.  
  184. Most compressors use LZ based compression which works very well for
  185. compressing chunky images.  The disadvantage is that compression is slow and
  186. that the image has to be translated back to PLANAR in order to be displayed.
  187. As stated earlier on, a straightforward way would be to compress the IFF
  188. Image directly.  As an example a 16 shade digipic called 'emmaspc.raw'
  189. consisting of complex digitized data would be compressed to 32764 bytes when
  190. using run length encoding (as used in IFF ILBM files)  This file can be
  191. reduced to around 25683 bytes when using LZH Crunchmania Data compression
  192. (By the way the program compresses data nearly as good as LHA)
  193. The RAW CHUNKY version of the emmaspc.raw digipic would originally take up
  194. 81920 bytes of space.  However when using